package com.spikything.gfx {
	
	import com.irisnation.ing.formula1.Style;
	import com.spikything.gfx.TextLabel;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;

	public class TextButton extends Sprite {
		
		protected var defaultColour :Number;
		protected var activeColour 	:Number 	= 0x435f75;
		protected var label 		:TextLabel;
		
		public function TextButton (txt:String = "", size:Number = 12, light:Boolean = false, colour:Number = 0x999999) {
			label = new TextLabel(txt, Style.BODY_TEXT_FORMAT);
			addChild(label);
			
			defaultColour = colour;
			addEventListener(MouseEvent.ROLL_OVER, onRollOver);
			addEventListener(MouseEvent.ROLL_OUT, onRollOut);
			buttonMode = true;
			mouseChildren = false;
		}
		
		protected function onRollOver (e:Event=null):void {
			label.textColor = activeColour;
		}
		protected function onRollOut (e:Event=null):void {
			label.textColor = defaultColour;
		}
		
		public function get text ():String { return label.text };
		public function set text (value:String):void { label.text = value };
		
	}
	
}